package org.dru.clay.respository.dependency;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class ConfigurationMapping implements MappingRule {
	private final List<MappingRule> rules;

	public ConfigurationMapping(List<MappingRule> rules) {
		this.rules = rules;
	}
	
	public ConfigurationMapping(MappingRule... rules) {
		this.rules = Arrays.asList(rules);
	}

	@Override
	public Set<String> transform(String config) {
		final Set<String> result = new HashSet<String>();
		for (MappingRule rule : rules) {
			result.addAll(rule.transform(config));
		}
		return result;
	}
}